var a = 2
let b = 4
const c = 8
console.log('a=' + a)
console.log('b=' + b)
console.log('c=' + c)
for (let i = 0; i < 5; i++) {
    if (a = 2) {
        a = c

    }
    console.log('for' + i)
}
console.log('变化后的a=' + a)


var fn1 = function () {
    console.log('es5无参函数')

}
fn1()
var fn2 = function (x, y) {
    console.log('es' + (x + y) + '有参函数')
}
fn2(2, 3)

function fn3() {
    return 'es5返回值'
}
var fn3 = fn3()
console.log(fn3)


var fn4 = () => {
    console.log('es6无参函数')
}
fn4()

var fn5 = (x, y) => {
    console.log('es' + (x + y) + '有参函数')
}
fn5(3, 3)

var fn6 = () => {
    return 'es6返回值'
}
var fn6 = fn6()
console.log(fn6)



var fn7 = function () {
    console.log('我是fn7')
    function fn8() {
        console.log('我是fn7下的fn8')

    }
    fn8()
}
fn7()


console.log(this)




//倒计时
let date = new Date('2020/11/11 23:59:59')
timer = setInterval(() => {
    var current = date.getTime() - 1000
    console.log(current)
     if(current<=1605110390000){
         clearInterval(timer)
     }
    date = new Date(current)
    console.log(date.toLocaleString())
}, 1000)



//随机选人
let studs = ['吴浩', '王豪', '赵永才', '王宇寻', '刘成浩', '王佳伟', '王庆辉']

function getName(){
    let random=Math.random()*studs.length
    let floor=Math.floor(random)
    let name=studs.splice(floor,1)
    return name
}
   timers= setInterval(() => {
        let txt=getName()
        if(txt.length<=0){
            clearInterval(timers)
        }else{
            console.log(txt[0])
        }
    }, 1000)